#pragma once

#include "Node.h"
#include "Algorithm.h"
#include "Factory.h"			/* factory is refered on this file * only */
#include "InputBuffer.h"

class NodeManager
{
public:
	Algorithm	algo;

private:
	Factory		factory;
	Node*		root;
	Node*		cursor; 
	InputBuffer*buffer;
	int			mode;
	CRect		viewRt;

public:
	NodeManager();
	~NodeManager();

	void	drawAll			(IDrawTool*);
	void	appendNode		();
	void	appendNode		(CString nodeName);
	void	setInputBuffer	(InputBuffer*);
	void	setRootPoint	(CPoint*);
	int		localInput		(UINT nChar);
	int		normalModeInput	(UINT);
	int		getMode			();
	void	endEditMode		();
	CRect	getCursorRect	();
	Node*	getCursor		();

	void	ChangeCursorFocus	( Node* now, int direction );
	void	SetCursor			(Node* node);
	Node*	GetRoot				();
	void	findHitedNode		(CPoint);
	void	setViewRt			(const CRect*);
	void	relocateAll			(const CRect* windRt);
};
